//
//  MainScene.h
//  FingerBlock
//
//  Created by GaoFeng on 14-5-29.
//
//

#ifndef __FingerBlock__MainScene__
#define __FingerBlock__MainScene__

#include "cocos2d.h"

using namespace cocos2d;
using namespace std;

class MainScene : public cocos2d::CCLayer
{
    CC_SYNTHESIZE(int, Block_V, Block_V);
    CC_SYNTHESIZE(int, Block_H, Block_H);
    CC_SYNTHESIZE(CCSize, BlockSize, BlockSize);
public:
    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();
    
    // there's no 'id' in cpp, so we recommend returning the class instance pointer
    static cocos2d::CCScene* scene();
    
    // implement the "static node()" method manually
    CREATE_FUNC(MainScene);
    
    void setGameBlock(int h_count, int v_count);
    
    virtual void registerWithTouchDispatcher(void);
    virtual void ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
    virtual void ccTouchesMoved(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
    virtual void ccTouchesEnded(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
    virtual void ccTouchesCancelled(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
    
    void FillBlock(bool oneLine = false);
    vector<CCNode *>TheBlocks;
    
    void cleanBlocks();
    
    void updateBlocks(float dt);
    bool startMove;
    float MoveTime;
    void makeBlocksMove();
    void makeBlocksStop();
};

#endif /* defined(__FingerBlock__MainScene__) */
